<!doctype html>
<head>
  <title>Reproduces the crash in https://crbug.com/848212</title>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script>
    'use strict'

     document.addEventListener("DOMContentLoaded", () => {
       test(() => {
         var anchorLink = document.getElementById("anchorlink");
         anchorLink.click();
         anchorLink.focus();
         assert_equals(document.activeElement, anchorLink);
       }, "should not crash on focus call");
     });
  </script>
  <link rel="stylesheet" type="text/css" href="/resources/load-and-stall.php?name=dummy.css&stallAt&stallFor=2">
</head>
<body>
  <div>
    <a id="anchorlink" href="#bottom">Link to bottom of the page</a>
  </div>
  <div style="height: 1000px;"></div>
  <a name="bottom" id="bt">Bottom of the page</a>
</body>
